/**
 * Module Modal CSS
 */

/* stylelint-disable declaration-no-important */
.module-modal-title {
  display: inline-block;
  vertical-align: top;

  > h4 {
    font-size: 14px;
    font-weight: 600 !important;
    color: var(--#{$cdk}primary-800) !important;
  }
}

.module-badges-display {
  display: inline-block;
}

.module-modal-header {
  .read-more-stars {
    bottom: 82px;
    left: 120px;

    &::before,
    &::after {
      left: -80px;
    }
  }

  button.close {
    width: auto;
    margin-top: -8px;

    .material-icons {
      font-size: 30px;
    }
  }
}

.module-modal-footer {
  .module-badges-action {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .module-price {
    position: relative;
    right: auto;
    bottom: auto;
  }

  .module-stars-price {
    padding: 0 0 10px;
  }
}

.module-big-cover {
  height: 240px;
  margin-top: -15px;
  overflow: hidden;
  text-align: center;
}

.module-big-cover > img {
  max-width: 100%;
  height: auto;
  max-height: 100%;
  padding: 4px;
}

.module-menu-readmore {
  width: calc(100% + 2.8rem);
  margin: 0 -1.4rem;
  margin-top: 2px;
}

.module-readmore-tab-content {
  padding: 5px 15px;
  margin-bottom: 61px !important;
  line-height: 20px;
  text-align: justify;
}

.module-readmore-multistore-content {
  padding: 5px 15px;
  margin-top: -60px;
  text-align: justify;
}

.module-menu-readmore > .tab-content {
  margin-top: 5px;
  color: $black;
  text-align: justify;
}

.module-modal-badges {
  margin-top: 1em;
}

.module-modal-badges > img {
  margin-right: 1em;
}

.module-modal-dialog {
  width: 50%;
  height: 85%;

  @include media-breakpoint-down(sm) {
    width: calc(100% - 2rem);
    margin: auto;

    .modal-header {
      > div {
        display: flex;

        h1 {
          font-size: 1rem;
        }

        img {
          width: 40px;
          height: 40px;
          margin-right: 1rem;
        }
      }

      button.close {
        padding: 0 1rem;
      }
    }

    .module-readmore-tab-content {
      padding: 0;
    }

    .tab-content {
      padding: 5px 15px 35px;
    }

    .navbar {
      padding: 0;
    }

    .nav {
      flex-wrap: nowrap;
      overflow: scroll;

      li {
        display: flex;

        .nav-link {
          display: flex;
          align-items: center;
          justify-content: center;
          width: max-content;
        }
      }
    }
  }
}

.module-modal-content {
  border: none;
  box-shadow: none;
}

.module-modal-close {
  width: auto !important;
  margin-right: 5px;
}

.module-short-list {
  margin: 2em 0;

  @include media-breakpoint-down(md) {
    margin: 1rem 0;
  }

  .module-list-empty {
    padding: var(--#{$cdk}size-16);
    background: var(--#{$cdk}primary-100);
    border: 1px dashed var(--#{$cdk}primary-500);

    p {
      padding: 0;
      margin: 0;
    }
  }
}

/**
 * Module list
 */

.module-item-list {
  .container-fluid {
    margin-top: -1px;

    background-color: $white;
    border: 1px solid var(--#{$cdk}primary-400);
    padding: {
      top: $grid-gutter-width / 2;
      bottom: $grid-gutter-width / 2;
    }
  }

  + :nth-child(even) {
    .container-fluid {
      background-color: var(--#{$cdk}primary-100) !important;
    }
  }

  .module-item-wrapper-list {
    > div {
      @media (max-width: 33.9em) {
        &:first-of-type {
          width: 25%;
        }

        &:last-of-type {
          width: 75%;

          > div:not(.modal) {
            position: initial;
          }
        }
      }
    }

    .module-logo-thumb-list {
      max-width: 64px;
      height: 64px;
      margin: 0 auto;
      @media (max-width: 33.9em) {
        height: auto;
        max-height: 64px;
      }

      img {
        width: 100%;
        max-width: 40px;
        margin-bottom: 0.5em;
      }
    }

    .module-name-list {
      margin: 0;
      font-weight: bolder;
      color: $gray-dark;

      @media (max-width: 33.9em) {
        padding-right: 1.5rem;
      }
    }

    .module-version-author-list {
      overflow: hidden;
      font-weight: 600;
      color: $gray-medium;
      text-overflow: ellipsis;
      white-space: nowrap;

      b {
        font-weight: 600;
        color: $gray-dark;
      }
    }

    .module-quick-action-list {
      > [class^="module-star-ranking-"] {
        display: none;
      }
    }
  }
}

.badges-container {
  min-height: 30px;
  font-size: 0.9rem;
  line-height: 50%;
}

.module-price {
  position: absolute;
  right: 15px;
  bottom: 50px;
}

.module-item-wrapper-grid .module-quick-action-grid {
  .spinner {
    position: absolute;
    bottom: 10px;
    left: 50%;
    margin-left: -20px;
  }

  .module-actions {
    display: flex;
    justify-content: flex-end;

    .dropdown-menu {
      right: 10px;
      left: 10px;
    }

    .btn-group,
    .btn {
      width: 100%;
    }
  }
}

/**
 * Addons Module Cast (List view);
 **/
.module-addons-item-list {
  display: none;
  cursor: pointer;
  user-select: none;
  /* stylelint-disable property-no-vendor-prefix  */
  -webkit-touch-callout: none;
  /* stylelint-enable property-no-vendor-prefix  */

  .module-addons-item-wrapper-list {
    text-align: center;
    vertical-align: middle;

    > .module-icon-addons-exit-list {
      > img {
        height: 3em;
      }
    }
  }
}

/**
 * Error message on catalog loading
 **/

.module-placeholders-failure {
  display: none;

  .module-placeholders-failure-wrapper {
    margin-top: 40px;
    text-align: center;
  }

  .module-placeholders-failure-msg {
    color: #f00;
  }

  #module-placeholders-failure-retry {
    margin-top: 10px;
  }
}

/**
 * OTHER: Generalist CSS for module pages
 */

#module-modal-bulk-confirm-action-name {
  font-weight: 600;
}

.module-checkbox-bulk-list {
  position: absolute;
  top: 7px;
  right: 7px;

  @media (max-width: 33.9em) {
    top: 0;
    right: 1rem;
  }

  &.md-checkbox label {
    padding: 0;
  }
}

.module-search-bar {
  height: 50px !important;
  background-color: $white !important;
  border: 0 !important;
}

.module-search-block {
  width: 100%;
  background: $white;

  .search-button {
    position: absolute;
    top: 0;
    right: 0;
    height: 35px;
    @include border-radius(0);
  }
}

.module-sort-active {
  color: #a6b9c0 !important;
}

.module-search-result-title {
  display: inline-block;
  margin-bottom: 20px;
  font-family: "Open Sans", Helvetica, Arial, sans-serif !important;
  font-size: 18px;
  font-weight: 700;
  color: #1e2024 !important;
}

.module-addons-search {
  display: none;
  font-family: "Open Sans", Helvetica, Arial, sans-serif !important;
  font-size: 14px;
  font-weight: 600;
}

.dropdown-menu .module-category-recently-used {
  text-align: center;
  border-bottom: 1px solid #e7e8e8;
}

.module-category-reset,
.module-status-reset {
  display: none;

  a {
    color: #2eacce !important;
    text-align: center;
    border-bottom: 1px solid #e7e8e8;

    &:hover {
      color: $white !important;
      text-align: center;
      background-color: #2eacce !important;
      border-bottom: 1px solid #e7e8e8;
    }
  }
}

.module-notification-kpis {
  margin: auto;
}

.module-kpi {
  display: initial;
  margin-right: 15px;

  .material-icons {
    font-size: 1.875rem;
    vertical-align: middle;
  }
}

.module-kpi-number {
  margin: auto;
  font-size: 30px;
  font-weight: 600;
}

.module-top-menu {
  min-height: 74px;

  .module-top-menu-item {
    &.disabled {
      pointer-events: none;
      opacity: 0.5;
    }

    h3 {
      margin-top: 30px;
      font-size: 14px;

      @include media-breakpoint-down(md) {
        margin-top: 1rem;
      }
    }
  }
}

.top-menu-separator {
  @include media-breakpoint-down(md) {
    margin-top: 1rem;
    margin-bottom: 0;
  }
}

/**
 * Module import
 **/

.module-import-processing {
  display: none;
  text-align: center;

  .btn {
    margin: 25px;
  }
}

.module-import-processing-footer-text {
  font-size: smaller;
  font-style: italic;
  color: #cecccc;
}

.module-import-success {
  display: none;
  text-align: center;
}

.module-import-success-icon {
  font-size: 70px;
  color: var(--#{$cdk}green-500);
}

.module-import-failure {
  display: none;
  text-align: center;
}

.module-import-failure-icon {
  font-size: 70px;
  color: #c45c67;
}

.module-import-failure-msg {
  margin-bottom: 0;
  font-weight: 600;
}

.module-import-failure-details-action {
  display: block;
  cursor: pointer !important;
}

.module-import-failure-details {
  display: none;
  margin: 35px 5px 20px;
  overflow: auto;
  overflow-y: hidden;
  font-size: small;
  text-align: justify;
  word-wrap: break-word;
}

.module-import-start-icon {
  font-size: 70px;
  color: var(--#{$cdk}primary-400);
}

.module-import-start-select-manual {
  text-decoration: underline;
  text-underline-offset: var(--#{$cdk}size-2);
  cursor: pointer !important;
  transition: var(--#{$cdk}default-transition);
}

.module-import-start-select-manual:hover {
  text-underline-offset: var(--#{$cdk}size-4);
}

.module-import-start-footer-text {
  font-size: var(--#{$cdk}size-12);
  font-style: italic;
  color: var(--#{$cdk}primary-500);
}

form#importDropzone {
  border: 2px dashed var(--#{$cdk}primary-400);
}

.dropzone.dz-clickable {
  cursor: auto !important;
}

.module-import-start {
  text-align: center;
}

.module-import-failure-retry {
  margin-top: 15px;
}

.module-import-success-configure {
  display: none;
}

/**
 * Module filters
 */
#position-filters {
  input[type="checkbox"] {
    display: none;

    &:checked ~ label {
      background-color: $primary;
      border-color: $primary;

      .done {
        opacity: 1;
      }
    }
  }

  .selectbox {
    position: relative;
    width: 20px;
    height: 20px;
    margin: 0 8px 0 0;
    vertical-align: middle;
    border: 2px solid var(--#{$cdk}primary-800);
    @include border-radius(2px);

    .done {
      margin-top: -7px;
      margin-left: -4px;
      font-size: 1.6em;
      color: var(--#{$cdk}white);
      opacity: 0;
    }
  }
}

/**
 * Module positions
 */

#modules-position-selection-panel {
  position: relative;
  z-index: 1;
  display: none;

  .btn {
    white-space: normal;
  }
}

.hook-panel {
  padding: 10px 10px 5px;
  margin-bottom: 10px !important;

  .highlight {
    background-color: var(--#{$cdk}blue-50) !important;
  }

  .hook-panel-header {
    padding: 0 10px 10px;
    margin: 0 -10px;

    .hook-name {
      padding: 0 4px;
      font-size: 1.4em;
      color: $brand-primary;
      background-color: $white;
      @include border-radius(3px);
    }

    .hook_title {
      @extend .text-muted;
    }

    .help-box {
      margin-bottom: 0.5rem;
      margin-left: 0;
    }

    .hook_description {
      @extend .text-muted;
      padding: 3px 0 0 3px;
    }

    .badge {
      color: #363a41;
      background-color: #f4f4f4;
      @include border-radius(4px);

      .selectbox i {
        line-height: 1.5;

        &.done {
          margin-top: -5px;
          margin-left: -2px;
        }
      }
    }
  }

  input[type="checkbox"] {
    display: none;

    &:checked ~ label {
      background-color: $primary;
      border-color: $primary;

      .done {
        opacity: 1;
      }
    }
  }

  .selectbox {
    position: relative;
    width: 20px;
    height: 20px;
    margin: 0 8px 0 0;
    vertical-align: middle;
    border: 2px solid var(--#{$cdk}primary-800);
    @include border-radius(2px);

    .done {
      margin-top: -7px;
      margin-left: -4px;
      font-size: 1.6em;
      color: $white;
      opacity: 0;
    }
  }
}

.modules_list_container_tab {
  img {
    max-width: 66px;
  }
}

.module-list {
  &-disabled {
    @extend .module-list;
    opacity: 0.5;
  }

  .module-item {
    width: 100%;
    padding: 5px 0;
    background: $white;
    border-bottom: solid 1px $gray-light;

    &:hover {
      background-color: $gray-soft;

      .drag_indicator {
        color: var(--#{$cdk}primary-800);
        opacity: 1;
      }
    }

    &:focus {
      outline: none;
    }

    &.ui-sortable-helper {
      background-color: var(--#{$cdk}blue-50);
      box-shadow: var(--#{$cdk}box-shadow-default);

      .module-name,
      .module-description,
      .module-column-position {
        color: var(--#{$cdk}primary-800);

        .text-muted {
          color: var(--#{$cdk}primary-800);
        }
      }

      .module-column-actions {
        .dropdown-toggle.dropdown-toggle-dots::after,
        i {
          color: var(--#{$cdk}primary-800);
        }
      }

      .drag_indicator {
        opacity: 1;
      }

      .selectbox {
        border-color: var(--#{$cdk}primary-800);
      }
    }

    &.draggable {
      cursor: all-scroll;
    }
  }

  .module-column-select {
    display: table-cell;
    width: 90px;
    min-height: 35px;
    padding: 0 10px;
    vertical-align: middle;

    .drag_indicator {
      opacity: 0;
    }
  }

  .module-column-position {
    display: table-cell;
    width: 80px;
    text-align: right;
    vertical-align: middle;

    .index-position {
      width: 40px;
      padding: 0 5px;
      font-size: 1em;
    }
  }

  .module-column-icon {
    display: table-cell;
    width: 75px;
    text-align: center;
    vertical-align: middle;

    img {
      max-width: 2.85em;
    }
  }

  .module-column-infos,
  .module-column-description {
    display: table-cell;
    height: 50px;
    font-size: 0.95em;
    vertical-align: middle;

    .module-name {
      color: $primary;
    }

    .module-description {
      color: $gray-dark;
    }
  }

  .module-column-infos {
    width: 200px;
    padding: 0 4px;
  }

  .module-column-description {
    width: 679px;

    &.hasColumnPosition {
      width: 600px;
    }
  }

  .module-column-actions {
    display: table-cell;
    padding: 0 10px;
    text-align: right;
    vertical-align: middle;

    .btn-group {
      text-align: right;

      .btn-outline-primary {
        color: $medium-gray;
        border: none;
      }
    }
  }

  .dropdown-menu {
    min-width: auto;
  }
}

#unhook-button-position-bottom {
  display: none;
}

.module-actions {
  @media (max-width: 33.9em) {
    margin-top: 1rem;
  }

  // @toDo: move to ui kit
  .dropdown-toggle-split-text {
    margin-left: 10px !important;
    color: #aeaeae;
    border-color: #aeaeae;

    &:hover {
      color: $white;
      background-color: #aeaeae;
    }
  }
}
/* stylelint-enable declaration-no-important */
